<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>点击我获取search值</button>
    <button>点击我设置search值</button>
    <script>
        // search : 获取或者设置 ?后面的参数；
        var btnEle = document.querySelector("button");
        btnEle.onclick = function () {
            // 获取？后面的内容
            var arg = window.location.search;
            console.log(arg);

        }

        // 设置 ？ 后面的内容
        var btnEle2 = document.querySelectorAll("button")[1];

        btnEle2.onclick = function () {
            window.location.search = "name=lisi";
        }


        // ?后面的参数 叫 queryString ：请求参、查询参 
        // ?后面的东西 有规则 ；键名=键值&键名=键值&键名=键值；  键名和键值都不需要加引号；


        /* 
        
        https://login.taobao.com/member/login.jhtml?redirectURL=http%3A%2F%2Fs.taobao.com%2Fsearch%3Fspm%3Da21bo.jianhua.201867-main.11.5af911d9XAQFVr%26q%3D%25E8%25BF%2590%25E5%258A%25A8%25E6%2588%25B7%25E5%25A4%2596&uuid=6cd1f792130e068b65e8a0aff36944fe
        
        https://detail.tmall.com/item.htm?id=654552722961&spm=a21bo.jianhua.201876.3.5af911d9XAQFVr&scm=1007.34127.227518.0&pvid=6500a3ab-8c71-4a4c-a79d-b4434b8381ea
        */
    </script>
</body>

</html>